package cn.wolfcode.wolf2w.controller;

import cn.wolfcode.wolf2w.domain.Banner;
import cn.wolfcode.wolf2w.query.BannerQueryObject;
import cn.wolfcode.wolf2w.service.IBannerService;
import cn.wolfcode.wolf2w.service.ITravelService;
import cn.wolfcode.wolf2w.util.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/index")
public class IndexController {

    @Autowired
    private IBannerService bannerService;



    @GetMapping("/query")
    public Object query(BannerQueryObject qo){
        return JsonResult.success(bannerService.query(qo));
    }

    //游记banner
    @GetMapping("/banners/travel")
    public Object travel(){
        List<Banner> banners= bannerService.queryByTypeAndState();
        return JsonResult.success(banners);
    }
    //攻略banner
    @GetMapping("/banners/strategy")
    public Object strategy(){
        List<Banner> banners= bannerService.queryByTypeAndStateForStrategy();
        return JsonResult.success(banners.get(0));
    }
}
